//
//  BaseWindow.swift
//  OnemeetingDemo
//
//  Created by 张衡 on 2019/12/6.
//  Copyright © 2019 www.onemeeting.1meetingIos. All rights reserved.
//

import Foundation

class BaseWindow: NSWindow {
    
    override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) {
        super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag)
        
        self.collectionBehavior = NSWindow.CollectionBehavior.fullScreenNone
        
        //设置圆角
        self.contentView?.layer?.masksToBounds = true
        self.contentView?.layer?.cornerRadius = 5
        self.contentView?.wantsLayer = true
        self.backgroundColor = NSColor.clear
        
        self.level = NSWindow.Level.normal
        
        self.isMovableByWindowBackground = true
        self.hasShadow = true
        //self.titlebarAppearsTransparent = true
        //self.titleVisibility = .hidden
        self.isMovable = true
        self.title = ""
        self.styleMask = [.titled,.closable,.miniaturizable]
        self.standardWindowButton(NSWindow.ButtonType.zoomButton)?.isHidden = true
        self.center()
    }
}
